package main

import (
	"fmt"
)

func forArray(data [3]string) {
	for k, v := range data {
		if k == 1 {
			break
		}
		fmt.Println(k, v)
	}
	for i := range data {
		fmt.Println(i, data[i])
	}
	for i := 0; i < len(data); i++ {
		fmt.Println(i, data[i])
	}
	for _, name := range data {
		fmt.Println(name)
	}
}

func forSlice(data []string) {
	for k, v := range data {
		if k == 1 {
			break
		}
		fmt.Println(k, v)
	}
	for i := range data {
		fmt.Println(i, data[i])
	}
	for i := 0; i < len(data); i++ {
		fmt.Println(i, data[i])
	}
	for _, name := range data {
		fmt.Println(name)
	}
}

func forMap(data map[int]string) {
	for k, v := range data {
		if k == 1 {
			continue;
		}
		fmt.Println(k, v)
	}
	for i := range data {
		fmt.Println(i, data[i])
	}
	for i := 0; i < len(data); i++ {
		fmt.Println(i, data[i])
	}
	for _, name := range data {
		fmt.Println(name)
	}
}


func main() {
	array1 := [3] string{"Tom", "Aaron", "John"}
	forArray(array1)

	slice1 := [] string {"Tom", "Aaron", "John"}
	forSlice(slice1)

	map1 := map[int]string{
		1 : "Tom",
		2 : "Aaron",
		3 : "John",
	}
	forMap(map1)
}